package com.ruoyi.business.service.impl;

import com.ruoyi.business.domain.WmsStoreRegionLocation;
import com.ruoyi.business.mapper.WmsStoreRegionLocationMapper;
import com.ruoyi.business.service.IWmsStoreRegionLocationService;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 库位管理Service业务层处理
 * 
 * @author yunlong
 * @date 2023-12-19
 */
@Service
public class WmsStoreRegionLocationServiceImpl implements IWmsStoreRegionLocationService
{
    @Autowired
    private WmsStoreRegionLocationMapper wmsStoreRegionLocationMapper;

    /**
     * 查询库位管理
     * 
     * @param id 库位管理ID
     * @return 库位管理
     */
    @Override
    public WmsStoreRegionLocation selectWmsStoreRegionLocationById(Long id)
    {
        return wmsStoreRegionLocationMapper.selectWmsStoreRegionLocationById(id);
    }

    @Override
    public WmsStoreRegionLocation selectWmsStoreRegionLocationBySn(String sn) {
        WmsStoreRegionLocation info = new WmsStoreRegionLocation();
        info.setSn(sn);
        List<WmsStoreRegionLocation> list = wmsStoreRegionLocationMapper.selectWmsStoreRegionLocationList(info);
        if(list.isEmpty()){
            return null;
        }else{
            return list.get(0);
        }
    }

    /**
     * 查询库位管理列表
     * 
     * @param wmsStoreRegionLocation 库位管理
     * @return 库位管理
     */
    @Override
    public List<WmsStoreRegionLocation> selectWmsStoreRegionLocationList(WmsStoreRegionLocation wmsStoreRegionLocation)
    {
        return wmsStoreRegionLocationMapper.selectWmsStoreRegionLocationList(wmsStoreRegionLocation);
    }

    /**
     * 新增库位管理
     * 
     * @param wmsStoreRegionLocation 库位管理
     * @return 结果
     */
    @Override
    public int insertWmsStoreRegionLocation(WmsStoreRegionLocation wmsStoreRegionLocation)
    {
        wmsStoreRegionLocation.setCreateTime(DateUtils.getNowDate());
        return wmsStoreRegionLocationMapper.insertWmsStoreRegionLocation(wmsStoreRegionLocation);
    }

    /**
     * 修改库位管理
     * 
     * @param wmsStoreRegionLocation 库位管理
     * @return 结果
     */
    @Override
    public int updateWmsStoreRegionLocation(WmsStoreRegionLocation wmsStoreRegionLocation)
    {
        wmsStoreRegionLocation.setUpdateTime(DateUtils.getNowDate());
        return wmsStoreRegionLocationMapper.updateWmsStoreRegionLocation(wmsStoreRegionLocation);
    }

    /**
     * 删除库位管理对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWmsStoreRegionLocationByIds(String ids)
    {
        return wmsStoreRegionLocationMapper.deleteWmsStoreRegionLocationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除库位管理信息
     * 
     * @param id 库位管理ID
     * @return 结果
     */
    @Override
    public int deleteWmsStoreRegionLocationById(Long id)
    {
        return wmsStoreRegionLocationMapper.deleteWmsStoreRegionLocationById(id);
    }
}
